import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


public class P50 {
	public static void main(String[] args) {
		
		
		long maxCount = 0;
		long maxSum = 0;
		
		long max = 1000000;
		List<Long> list = Util.primeList(max);
		Set<Long> set = new HashSet<Long>(list);
		
		for (long i = 0; i < list.size(); i++) {
			long sum = list.get((int)i);
			System.out.println(sum);
			List<Long> l = new ArrayList<Long>();
			l.add(sum);
			
			int count = 1;
			for (long j = i + 1; j < list.size(); j++) {
				long x = list.get((int)j);
				l.add(x);
				sum += x;
				count++;
				
				if (sum > max) {
					break;
				}
				
				if (set.contains(sum)) {
					if (maxCount < count) {
						maxCount = count;
						maxSum = sum;
						System.out.println(l);
					}
				}
			}
		}
		
		System.out.println(maxCount);
		System.out.println(maxSum);
	}
}
